import React, { useEffect } from "react";
import * as qs from "query-string";
import {
  Route,
  withRouter,
} from "react-router-dom";

interface Props {
  component:any,
  path:string,
  exact:boolean,
  strict:boolean,
  meta:object,
}
const PriteRouter = (props: any) => {
  const {
    component: Component,
    path,
    exact,
    strict,
    meta
  } = props;
 
  const { search } = props.location;
  props.location.state = qs.parse(search);
  useEffect(() => {
    return () => {
     
    }
  }, [props])
  return (
    <Route
      {...props}
      path={path}
      exact={exact}
      strict={strict}
      meta={meta}
      render={(props) => <Component {...props} meta={meta} />}
    />
  );
}
export default withRouter(PriteRouter);
